﻿Ext.onReady(function () {
    Ext.apply(Kwan, {
        def: Consume
    });
});
Ext.apply(Kwan, {
    consumeColor: ['red', 'blue', 'green', 'red', 'blue', 'blue'],
    consumeTips: ['系统作废', '未结账', '已结账', '已冲红', '已挂账', '已免受'],
    prepareConsume: function (d) {
        var template = '<span style="color:{0};">{1}</span>';
        return String.format(template, Kwan.consumeColor[d], Kwan.consumeTips[d]);
    },
    search: function (index) {
        var roomNO = qRoomNO.getValue(),
                startDate = Ext.util.Format.date(qStartDate.getValue(), 'Y-m-d'),
                endDate = Ext.util.Format.date(qEndDate.getValue(), 'Y-m-d');
        if (index == 0) {
            qRoomNO.reset();
            txtFilter.setValue('');
            qRoomNO.triggers[0].hide();
        }
        else {
            var val = "";
            val += (roomNO.length > 0 ? roomNO : "") + ",";
            val += (startDate.length > 0 ? startDate : "") + ",";
            val += (endDate.length > 0 ? endDate : "") + ",";
            txtFilter.setValue(val);
        }
    }
});